home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / cdrift3.zip / UNIX.C < prev    next >
C/C++ Source or Header  |  1990-02-22  |  1KB  |  42 lines

  1. /* This program is Copyright (c) 1990 David Allen.  It may be freely
  2.    distributed as long as you leave my name and copyright notice on it.
  3.    I'd really like your comments and feedback; send e-mail to
  4.    davea@vlsi.ll.mit.edu, or send us-mail to David Allen, 10 O'Moore Ave,
  5.    Maynard, MA 01754. */
  6.  
  7.  
  8. /* This file substitutes for ami.c.  The function draw() is called by 
  9.    onestep() once every DRAWEVERY steps, and it just calls tecst() in 
  10.    tec1.c.  Most of the functions in this file are dummies; see ami.c for
  11.    more details on what they were. */
  12.  
  13.  
  14. #include "const.h"
  15. #include "var.h"
  16. #include <sys/types.h>
  17. #include <sys/timeb.h>
  18.  
  19. extern short step;
  20.  
  21.  
  22. main (argc, argv) int argc; char **argv; { struct timeb t;
  23.  
  24.    /* Initialize random number generator */
  25.    ftime (&t); srandom ((int) ((t.time % 100000) + t.millitm));
  26.  
  27.    /* Run the program */
  28.    init (*++argv);
  29.    for (step=0; step<MAXSTEP; step++) onestep ();
  30.    exit (0); }
  31.  
  32.  
  33. rnd (top) short top; { return (random () % top); }
  34.  
  35.  
  36. panic (s) char *s; { printf ("PANIC: %s\n", s); exit (1); }
  37.    /* Used when some fatal inconsistency is found in the database;
  38.    its function is to just exit the program. */
  39.  
  40.  
  41. draw (src) short src; { tecst (src, DRAWMODE); }
  42.